package com.WaVel.mapper;

import com.Emplyment.dto.ReUserPasswordDto;
import com.Emplyment.entity.UserMessage;
import com.Emplyment.enumeration.OperationType;
import com.WaVel.annotation.AutoFill;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    /**
     * 查询用户信息
     * @param id
     * @return
     */
    UserMessage SelectEmplyeeMessage(Long id);


    /**
     * 修改用户信息
     * @param dto
     */
    @AutoFill(value = OperationType.UPDATE)
    void updateUser(UserMessage dto);


    /**
     * 修改图片信息
     * @param img
     */
    @Update("update user set userPic = #{img} where id = #{id}")
    @AutoFill(value = OperationType.UPDATE)
    void updateAvatar(String img,Long id);

    /**
     * 修改密码
     * @param
     */
    @Update("update user set password = #{confirmPassword} where username = #{username}")
    void updatePassword(String username, String confirmPassword);

    @Select("select * from user where username = #{username}")
    UserMessage selectUserByUsername(String username);
}
